/**
 * 删除指定元素
 * @param callback 执行函数或属性值
 * @returns {*} 已删除元素
 */

export const array = {
    remove: function (obj, callback) {
        if (callback instanceof Function) {
            const index = obj.find(callback)
            return this.remove(obj, index)
        }

        const index = obj.indexOf(callback)
        if (index > -1) {
            obj.splice(index, 1)
            return callback
        }
    }
}

export const path = {
    getSuffix: function (path) {
        const index = path.lastIndexOf('.')
        if (index > -1) {
            return path.substr(index)
        }
        return null
    }
}
